﻿//Created by Action Script Viewer - http://www.buraks.com/asv
package reprise.geom {
    import reprise.utils.*;

    public class Vector2D {

        public var y:Number;
        public var x:Number;

        public function Vector2D(_arg1:Number, _arg2:Number){
            this.x = _arg1;
            this.y = _arg2;
        }
        public function negate():void{
            x = -(x);
            y = -(y);
        }
        public function rotateNew(_arg1:Number):Vector2D{
            var _local2:Vector2D = clone();
            _local2.rotate(_arg1);
            return (_local2);
        }
        public function scale(_arg1:Number):void{
            x = (x * _arg1);
            y = (y * _arg1);
        }
        public function crossProduct(_arg1:Vector2D):Number{
            return (((x * _arg1.x) + (y * _arg1.y)));
        }
        public function minusNew(_arg1:Vector2D):Vector2D{
            return (new Vector2D((x - _arg1.x), (y - _arg1.y)));
        }
        public function setAngle(_arg1:Number):void{
            var _local2:Number = getLength();
            x = (_local2 * MathUtil.cos(_arg1));
            y = (_local2 * MathUtil.sin(_arg1));
        }
        public function angle():Number{
            return (MathUtil.atan(x, y));
        }
        public function reset(_arg1:Number, _arg2:Number):void{
            this.x = _arg1;
            this.y = _arg2;
        }
        public function isPerpTo(_arg1:Vector2D):Boolean{
            return ((crossProduct(_arg1) == 0));
        }
        public function plus(_arg1:Vector2D):void{
            x = (x + _arg1.x);
            y = (y + _arg1.y);
        }
        public function rotate(_arg1:Number):void{
            var _local2:Number = MathUtil.cos(_arg1);
            var _local3:Number = MathUtil.sin(_arg1);
            var _local4:Number = ((x * _local2) - (y * _local3));
            var _local5:Number = ((x * _local3) + (y * _local2));
            x = _local4;
            y = _local5;
        }
        public function getLength():Number{
            return (Math.sqrt(((x * x) + (y * y))));
        }
        public function clone():Vector2D{
            return (new Vector2D(x, y));
        }
        public function plusNew(_arg1:Vector2D):Vector2D{
            return (new Vector2D((x + _arg1.x), (y + _arg1.y)));
        }
        public function normal():Vector2D{
            return (new Vector2D(-(y), x));
        }
        public function setLength(_arg1:Number):void{
            var _local2:Number = getLength();
            if (_local2){
                scale((_arg1 / _local2));
            } else {
                x = _arg1;
            };
        }
        public function toString():String{
            return ((((((("[class 'Vector' x:" + x) + ", y:") + y) + ", angle: ") + angle()) + "]"));
        }
        public function radians():Number{
            return (Math.atan2(y, x));
        }
        public function angleBetween(_arg1:Vector2D):Number{
            var _local2:Number = crossProduct(_arg1);
            var _local3:Number = (_local2 / (getLength() * _arg1.getLength()));
            return (MathUtil.acos(_local3));
        }
        public function scaleNew(_arg1:Number):Vector2D{
            return (new Vector2D((x * _arg1), (y * _arg1)));
        }
        public function minus(_arg1:Vector2D):void{
            x = (x - _arg1.x);
            y = (y - _arg1.y);
        }
        public function radiansBetween(_arg1:Vector2D):Number{
            var _local2:Number = crossProduct(_arg1);
            var _local3:Number = (_local2 / (getLength() * _arg1.getLength()));
            return (Math.acos(_local3));
        }
        public function negateNew():Vector2D{
            return (new Vector2D(-(x), -(y)));
        }
        public function equals(_arg1:Vector2D):Boolean{
            return ((((x == _arg1.x)) && ((y == _arg1.y))));
        }

    }
}//package reprise.geom 
